package io.itit.ecp.admin.provide.selected;

import io.itit.ecp.admin.common.enums.MeterDeviceStaticsTypeEnums;
import io.itit.grass.common.provide.action.resp.SelectedResp;
import io.itit.grass.common.server.selected.ISelected;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Component(value = MeterDeviceStaticsTypeSelected.CODE)
public class MeterDeviceStaticsTypeSelected implements ISelected<SelectedResp> {

    public final static String CODE = "MeterDeviceStaticsType";

    @Override
    public String code() {
        return CODE;
    }

    @Override
    public List<SelectedResp> get(String param) {
        return Arrays.stream(MeterDeviceStaticsTypeEnums.values())
                .map(t -> SelectedResp.builder().label(t.getLabel()).value(t.getValue()).build())
                .collect(Collectors.toList());
    }
}
